package code2;

import java.util.Scanner;

public class Code {

    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);
        String s1 = input.next();
        String s2 = input.next();

        if(s1 == null || s2 == null){
            System.out.println("没有相同的子串");
        }else{
            int len1 = s1.length();
            int len2 = s2.length();

            if(len1 == 0 || len2 == 0){
                System.out.println("没有相同的子串");
            }else {
                if(len1>=len2){
                    System.out.println(func(s1, s2, len1, len2));
                }else{
                    System.out.println(func(s2, s1, len2, len1));
                }
            }
        }
    }

    public static String func(String s1, String s2, int len1, int len2){

        String str;
        for(int i=0; i<len2; i++){
            for(int j=0;j<=i;j++){
                str = s2.substring(j, len2-(i-j));
                if(s1.contains(str)){
                    return str;
                }
            }
        }
        return "没有相同的子串";
    }
}


